package top.heathylife.gateway.common.cons;

/**
 * @author maoxiaomeng
 */
public class SystemCons {
    public static final String TYC_SHORT_NAME = "tyc";
    public static String systemConfig = "systemConfigObj";
    public static String secret = "secret";
    public static String NO = "no";
    public static final String REDIS_CACHE_KEY = "interface:call:log:%s";
    public static final Long CACHE = 90L;
    public static final String ORIGIN_DATA = "originData";
    public static final String REQ_ORIGIN_DATA = "reqOriginData";
    /**
     * 失败重试次数
     */
    public static int ReCount = 3;

    /**
     * 缓存的存储路径
     */
    public static String systemHealthKey = "interface:api:gateway:%s";
    public static String platformKey = "gateway:platform";

    public static String systemApiUrl = "http://%s/api/unify";
    public static String checkTokenUrl = "http://%s/api/unify/check";

    public static String systemConfigUrl = "http://%s";
    /**
     * 请求的凭证
     */
    public static String systemSecret = "interface:api:%s:secret:%s";

    public static String getSystemSecret(String secret, String shortName) {
        return String.format(systemSecret, shortName, secret);
    }

    public static String getSystemApiUrl(String systemApplicationName) {
        return String.format(systemApiUrl, systemApplicationName);
    }

    public static String getCheckTokenUrl(String systemApplicationName) {
        return String.format(checkTokenUrl, systemApplicationName);
    }

    public static String systemHealthKey(String systemName) {
        return String.format(systemHealthKey, systemName);
    }
    public static String platformKey() {
        return platformKey;
    }

    public static String getSystemConfigUrl(String systemApplicationName) {
        return String.format(systemConfigUrl, systemApplicationName);
    }
}
